import React from 'react';
import { NewGuid } from 'ronds-react-ui';
import NormalCell from './components/NodeCell/Normal';
import RefCell from './components/NodeCell/Ref';

export const renderNodeInfo = (info: any) => {
  const keys = Object.keys(info);
  console.log(keys);

  return (
    <div style={{ borderLeft: '1px solid #000' }}>
      {(keys || []).map((it: any) => {
        if (it !== 'id' && it !== 'type' && info[it].toString().indexOf('uloveits') === -1) {
          return (
            <div key={NewGuid()}>
              <NormalCell label={it} value={info[it]} />
            </div>
          );
        }

        if (it !== 'id' && it !== 'type' && info[it].toString().indexOf('uloveits') !== -1) {
          return (
            <div key={NewGuid()}>
              <RefCell label={it} value={info[it]} />
            </div>
          );
        }
        return null;
      })}
    </div>
  );
};
